import 'package:json_annotation/json_annotation.dart';

part 'invite.g.dart';

@JsonSerializable()
class InviteRankingModel {
  String nickname;

  String avatar;

  String mobile;

  int num;

  double amount;

  InviteRankingModel(
      {required this.avatar,
      required this.nickname,
      required this.mobile,
      required this.num,
      required this.amount});

  factory InviteRankingModel.fromJson(Map<String, dynamic> json) =>
      _$InviteRankingModelFromJson(json);

  Map<String, dynamic> toJson() => _$InviteRankingModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

@JsonSerializable()
class InviteDetailModel {
  String nickname;

  String avatar;

  String mobile;

  String registerTime;

  InviteDetailEnum type;

  InviteDetailModel(
      {required this.nickname,
      required this.avatar,
      required this.mobile,
      required this.registerTime,
      this.type = InviteDetailEnum.register});

  factory InviteDetailModel.fromJson(Map<String, dynamic> json) =>
      _$InviteDetailModelFromJson(json);

  Map<String, dynamic> toJson() => _$InviteDetailModelToJson(this);

  @override
  String toString() {
    return toJson().toString();
  }
}

@JsonEnum()
enum InviteDetailEnum {
  register(1, '邀请注册');

  final int statusCode;
  final String statusName;

  const InviteDetailEnum(this.statusCode, this.statusName);
}
